<template>
	<!-- <div v-if="testList.length == 0">
		<div class="work_cont">
			<div class="add_btn" @click="show = true">+</div>
			<img src="@/assets/image/other/add_work.png" alt="">
		</div>
	</div>
	<div v-else class="add_btn continue" @click="show = true">+</div>
	<answerPage  v-if="testList.length > 0" />
	<van-popup v-model:show="show" :style="{ width: '50%', height: '100%', padding:'10px' }"  position="right">
		<div class="pop-box">
			<div class="header">
				<p>添加测试用户</p>
				<p @click="show = false">x</p>
			</div>
			<div class="pop-cont">
				<div v-for="item,index in poplist" :key="index" class='pop-item'>
					<div>
						<p class='name'>{{index + 1}}.{{item.userName}}</p>
						<p class='cont'>{{item.cont}}</p>
					</div>
					<div>
						<div class="add_btn_two"  @click="add(item)">添加</div>
					</div>
				</div>
			</div>
		</div>
	</van-popup> -->
	<div>
		frfr
	</div>
</template>

<script setup lang="ts">
	import { ref, watch, onUnmounted,onMounted,computed } from 'vue';
	import AppVue from '@/App.vue';
	import { useWorkBenches,useWebstock } from '@/store';
	import { useRouter } from 'vue-router';
	import answerPage from "@/views/answerPage/index.vue";
	import localCache from '@/utils/cache';
	import { Toast } from 'vant';
	
	const ROUTER = useRouter();
	
	const show = ref(false);
	// const poplist = ref([]);
	
	const Workben = useWorkBenches();
	const webstockStore = useWebstock();
	const testList = computed(()=> Workben.$state.workerPatientList);
	const poplist = computed(()=> Workben.$state.poplist);
	
	// async function getListFn(){
	// 	const res = await patinetList({ page:1,size:100 });
	// 	if(!res) return;
	// 	const { list, total } = res;
	// 	if(list){
	// 		poplist.value = list;
	// 	}
	// }
	
	const add = async (row)=>{
		// AppVue.websocket.send('Hello, server!');
		const res = await webstockStore.sendMessage({ messageCode:'2',userId: row.id });
		if(!res) return;
		Workben.getpopList(true);
		// getListFn();
		// console.log(row, "dd");
		// poplist.value[index].ischeck = !poplist.value[index].ischeck;
		// localStorage.setItem('testitem', JSON.stringify(poplist.value));
		// Workben.getList(true);
	};
	
	onMounted(()=>{
		Workben.getpopList(true);
		// getListFn();
		// Workben.getList(true);
		// console.log(res);
	});

</script>
<style lang="less" scoped>
	.work_cont{
		display: flex;
		height: 100vh;
		justify-content: center;
		align-items: center;
		img{
			width: 254px
		}
	}
	// .text_work{
	// 	position: relative;
	// }
	.add_btn{
		font-size: 20px;
		color: #fff;
		width: 25px;
		height: 25px;
		line-height: 25px;
		text-align: center;
		background: #13CE8F;
		border-radius: 50%;
		&.continue{
			position: absolute;
			top:200px;
			left: 140px;
			// z-index: 10000;
		}
	}
	.pop-box{
		// width:500px;
		// height:100px;
		font-size: 16px;
		.header{
			display: flex;
			justify-content: space-between;
			font-family: Source Han Sans CN;
			font-size: 16px;
			font-weight: bold;
			color: #3D3D3D;
		}
		.pop-cont{
			height: 90vh;
			overflow: auto;
			.pop-item{
				margin: 5px 10px;
				padding: 5px;
				display: flex;
				justify-content: space-between;
				align-items: center;
				// height: 75px;
				border-radius: 6px;
				opacity: 1;
				background: #FFFFFF;
				box-shadow: 0px 4px 6px 0px rgba(202, 202, 202, 0.3);
				.name{
					font-size: 15px;
				}
				.cont{
					font-size: 12px;
					color: #667085;
				}
			}
		}
	}
	.add_btn_two,.add_close{
		width: 54px;
		border: 1px solid #13CE8F;
		border-radius: 17px;
		color: #13CE8F;
		font-size:12px;
		text-align: center;
	}
</style>